<?php
if ($db = new SQLite3('test1.db')){
    $result = $db->query("select * from _serverlist");
	$datapie = array();
	$row = array();
	$i=0;
    while($res = $result->fetchArray(SQLITE3_ASSOC)){ 
        if(!isset($res['id'])) continue; 
  		$row[$i]['name'] = $res['name']; 
  		$row[$i]['ipaddr'] = $res['ipaddr']; 
  		$row[$i]['diskfree'] = $res['diskfree']; 
	    $i++; 
	} 	 
	header("Content-type: application/json"); 
	echo json_encode($row);
	//echo "{\"data\":" .json_encode($row). "}";
	$db->close();
} else {
    die($sqliteerror);
}
?>